%!
%%BoundingBox: 0 0 595 842
%%Title: AMANDA ExaLabel
%%Pages: 1
%%EndComments

%%%%
%%%% This is a template file used by AMANDA to create PostScript tape
%%%% labels for each dump.  This file is set up for DAT 4mm tapes,
%%%% but you can edit it to work with anything.
%%%%
%%%% NOTE: this is quick-hack for DAT TAPES; it is simply a scaled 
%%%% version of the Exabyte version.
%%%%

%
% The label is made up of 6 parts:  statistics, tape name, date,
% header, filesystem list, and the logo.  Geometrically, the label 
% looks like this:
%
%   +------------------------+
%   |statistics              |   <- section 'A'
%   +----+-------------------+
%   |logo|     TAPE_NAME     |   <- section 'B'  (logo) <- section 'F'
%   |    | version      date |   <- section 'C'
%   +----+--+--------+-------+
%   | h   fs   l | h  fs   l |   <- section 'D'
%   +-------+--------+-------+
%   |            |           |   <- section 'E'
%   |            |           |
%   v            v           v
%
% Sections D and E, which hold the bulk of the information are 
% cut into columns.
%

% Quick-hack for DAT tapes
%

72 25.4 div dup scale              %% scale to millimeters

% section 'A' font, start position, and line separation
%
/StatFont 		{ /Courier findfont 4.5 scalefont setfont } def
/StatPos		{ 30 255 } def
/StatSep		{ 4 } def

% section 'B' font and position (text centered around this point)
%
/TitleFont		{ /Helvetica-Bold findfont 10 scalefont setfont } def
/TitlePos		{ 115 230 } def

% section 'C' font, position of the date (left justified) and the version
%
/DateFont		{ /Palatino-Bold findfont 5 scalefont setfont } def
/DatePos		{ 190 222 } def
/VersFont		{ /Palatino-Bold findfont 5 scalefont setfont } def
/VersPos		{ 43 222 } def

% section 'D' font, and field positions (x coord is relative to each column)
%

/HeadingFont		{ /Palatino-Bold findfont 5 scalefont setfont } def
/HeadingHostPos		{ 1 212 } def
/HeadingFsPos		{ 17 212 } def
/HeadingLvlPos		{ 57 212 } def

% section 'E' font, and line separation
%
/HostFont		{ /Courier findfont 2.6 scalefont setfont } def
/HostSep		{ 2.5 } def


% the following rectangles separate the regions
%
/StatBox		{ 200 260 15 240 } def
/TitleBox		{ 200 240 15 220 } def
/LogoBox		{ 35 240 15 220 } def
/HeadingBox		{ 200 220 15 210 } def
/HostBox		{ 200 210 15 0 } def
% Punckmark marks center of page height to aid punching holes for ring binder
/PunchMark		{ 13 130 15 130 } def

% number of columns for section 'E,' column width, position of first 
% entry in first column, y coordinate of top and bottom of dividing lines
%
/NumColumns		{ 3 } def
/ColumnWidth		{ 60 } def
/ColumnBasePos		{ 16 200 } def
/TopColDivLine		{ 201 } def
/BotColDivLine		{ 2 } def

% 5

%%%%
%%%% END OF USER-CONFIGURABLE OPTIONS
%%%%
%%%% the rest of this file contains the internal functions that are used
%%%% by genlabel to draw the label
%%%%


%
% Initial Setup... draws everything that is the same for all labels
%

% function to draw a box
%
/box {
	/ury exch def
	/urx exch def
	/lly exch def
	/llx exch def

	llx lly moveto
	llx ury lineto
	urx ury lineto
	urx lly lineto
	closepath
} def


% move the origin up a bit
%
0 19 translate

% draw all of the boxes
%
0 setgray 
.3 setlinewidth					% thick lines
StatBox box stroke
TitleBox box stroke
LogoBox box stroke
HeadingBox box stroke
HostBox box stroke
% and the PunchMark to aid puching ring binder holes
PunchMark box stroke

% draw the column dividers
%
0.2 setlinewidth				% thin lines
/i 1 def
{
	NumColumns i sub 0 le { exit } if	% no lines if this last col.
	/xoff ColumnBasePos pop			% get x base position
	   i ColumnWidth mul add def		% offset for this column
	xoff TopColDivLine moveto 
	xoff BotColDivLine lineto stroke	
	/i i 1 add def
} loop


% draw the heading names
%
/i 0 def
HeadingFont
{
	NumColumns i sub 0 le { exit } if
	/xoff ColumnBasePos pop
	  i ColumnWidth mul add def
	HeadingHostPos exch xoff add exch moveto
	  (Host) show
	HeadingFsPos exch xoff add exch moveto
	  (Fs) show
	HeadingLvlPos exch xoff add exch moveto
	  (*) show
	/i i 1 add def
} loop


%
% the following functions draw strings for each kind of information
%

/CurrStatY StatPos exch pop def
ColumnBasePos /CurrColumnY exch def
  /CurrColumnX exch def


% DrawStat draws the string on the top of the stack in the next position
% in section 'A'
%
/DrawStat {
	StatFont
	StatPos pop CurrStatY moveto
	show
	/CurrStatY CurrStatY StatSep sub def
} def


% DrawTitle draws the string on the top of the stack in section 'B'
%
/DrawTitle {
	TitleFont
	TitlePos moveto
	dup stringwidth pop 2 div neg 0 rmoveto
	show
} def


% DrawDate draws the string on the top of the stack in section 'C'
%
/DrawDate {
	DateFont
	DatePos moveto
	dup stringwidth pop neg 0 rmoveto
	show
} def


% DrawVers draws the string on the top of the stack in section 'C'
%
/DrawVers {
	VersFont
	VersPos moveto
	show
} def


/StripDomain {

(.) search {
  3 1 roll pop pop
} if

} def

/TrimFs {

dup length 25 gt {
  dup (*                         ) dup 4 2 roll length 24 sub 24 getinterval 1 exch putinterval
} if

} def


% DrawHost expects five strings to be on the stack; right now it
% uses only the first three.  The strings are Host Name, Partition Name,
% Dump Level, Tape File Number, and Output Size.
% 
/DrawHost {
	HostFont
	pop pop pop 			% discard sizes and fileno
	CurrColumnX HeadingLvlPos pop add CurrColumnY moveto
	show
	CurrColumnX HeadingFsPos pop add CurrColumnY moveto
	TrimFs
	show
	CurrColumnX HeadingHostPos pop add CurrColumnY moveto
	StripDomain
	show
	/CurrColumnY CurrColumnY HostSep sub def
	CurrColumnY BotColDivLine lt {
		/CurrColumnY ColumnBasePos exch pop def
		/CurrColumnX CurrColumnX ColumnWidth add def
	} if
} def


%%%%
%%%% END OF TEMPLATE FILE
%%%% 

